<template>
  <a-config-provider :locale="locale" :getPopupContainer="getPopupContainer">
    <router-view />
  </a-config-provider>
</template>
<script>
import zhCN from "ant-design-vue/lib/locale-provider/zh_CN";
import { setRemSize } from "@/utils/index";
export default {
  data() {
    return {
      locale: zhCN
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.resizefn_ = setRemSize();
      this.resizefn_();
      window.addEventListener("resize", this.resizefn_);
    });
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.resizefn_);
  },
  methods: {
    getPopupContainer(el, dialogContext) {
      if (dialogContext) {
        return dialogContext.getDialogWrap() || document.body;
      } else if (el) {
        return el.parentNode || document.body;
      }
      return document.body;
    }
  }
};
</script>
